﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Logic.ClarizenSvc;

namespace Logic.ClarizenObjects
{
    public class Attachment: BaseObject
    {
        public String Comment { get; set; }
        [Clarizen(Selectable = true, Editable = false)]
        public DateTime CreatedOn { get; set; }
        public GenericEntity AttachedTo { get; set; }
        [Clarizen(Selectable = true, Editable = false)]
        public GenericEntity CreatedBy { get; set; }
        [Clarizen(Selectable=true, Editable=false)]
        public String CreatedBy_Name { get { return CreatedBy == null? null: CreatedBy.GetFieldValue("Name"); } }

        [Clarizen]
        public String CreatedOnString { get { return CreatedOn == null ? null : CreatedOn.ToString("MM/dd/yy"); } }
        public GenericEntity Visibility { get; set; }
        [Clarizen]
        public String VisibilityID 
        {
            get { return Visibility == null ? null : Visibility.Id.Value; }
            set
            {
                if (Visibility == null)
                    Visibility = new GenericEntity();
                Visibility.Id = new EntityId {TypeName="CommentType", Value=value };
            }
        }

        //public GenericEntity RelatedEntity { get; set; }
    }
}
